<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>升级VIP - FRM</title>
	<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
	<meta content="yes" name="apple-mobile-web-app-capable" />
	<meta content="black" name="apple-mobile-web-app-status-bar-style" />
	<meta content="telephone=no" name="format-detection" />
     <link href="./css/a.css" rel="stylesheet" type="text/css"/>
	 
	 		
		<style type="text/css">

	   .display-block{
	   display :block ;
	   }
	   
	   .display-none{
	   display :none ;
	   }
	   
	   
	   
	   
	  .aui-flex-border {
    border-radius: 50px;
    padding: 0;
    background: #f4f3f3;
	
} 
	   
	.aui-flex {
    display: -webkit-box;
    display: -webkit-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
	
	margin: 0px auto; 
	width: 90%;
	margin-bottom: 10px;

}


.aui-flex-box {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: #333;
}


.aui-flex-box input {
    border: none;
    background: none;
    font-size: 0.85rem;
    padding-left: 1.4rem;
	width: 100%;
	height: 40px;
}


.aui-button-once button {
    background-image: linear-gradient(to bottom,#a442ce,#b84dc7);
    background-color: #a241cf;
    box-shadow: 0 0 19px #dd7fe6;
    color: #fff;
    font-size: 0.9rem;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    border: none;
    margin-top: 8px;
    margin-bottom: 8px;
    margin-right: 10px;
}   
.vip_time{
	padding-left: 6%;
	color: #fff;
}

		</style>
			
	 
</head>
<body>

<section class="aui-flexView">

	<section class="aui-scrollView">
		<div class="aui-member-head">
			<div class="aui-flex">
				<div class="aui-flex-user" id="headimgurl">
					<img src="">
				</div>
				<div class="aui-flex-box aui-flex-box-top">
					<h2 id="username"> <em>升级会员</em></h2>
				</div>
			</div>
			
			<div class="vip_time">
				<p>积分：<span id="user_points"></span></p>
				<p>截至：<span id="vip_time"></span></p>
			</div>
	
			<div class="aui-member-box">

				<div class="aui-palace">
				
				<h1>
					<img src="">
				</h1>
				
				
					<a href="#" class="aui-palace-grid">
						<div class="aui-palace-grid-icon">
							<img src="">
						</div>
						<div class="aui-palace-grid-text">
							<h2>全网VIP影视</h2>
							<p>任性看</p>
						</div>
					</a>
					<a href="#" class="aui-palace-grid">
						<div class="aui-palace-grid-icon">
							<img src="">
						</div>
						<div class="aui-palace-grid-text">
							<h2>海量推荐影视</h2>
							<p>抢先看</p>
						</div>
					</a>
					<a href="#" class="aui-palace-grid">
						<div class="aui-palace-grid-icon">
							<img src="">
						</div>
						<div class="aui-palace-grid-text">
							<h2>全球直播</h2>
							<p>随意看</p>
						</div>
					</a>
					

					
				</div>

			</div>
		</div>
		
		

		<div class="aui-flex-b">
			<div class="aui-flex-box">
				<h2> <i class="icon icon-member"></i> 升级超级会员</h2>
			</div>
		</div>
		<div class="aui-flex-member-list">
			<div class="aui-flex aui-flex-border"> 
				<div class="aui-flex-box">
					<input  id="card_no"  type="text" placeholder="请输入充值卡号" >
				</div>
				
			</div>	
			
			<div class="aui-flex aui-flex-border"> 
				<div class="aui-flex-box">
					<input  id="card_pwd"  type="text" placeholder="请输入充值卡密码" >
				</div>
				
			</div>			
		</div>
		
	
		<div class="aui-member-get" >
			<button   onclick="up_post()">立即充值</button>
		</div>
	
	</section>
</section>
</body>

<script type="text/javascript" src="../../script/api.js" ></script>
<script type="text/javascript" src="../public/public.js" ></script>
<script type="text/javascript">
    apiready = function(){
      api.parseTapmode();
	  headimgurl.innerHTML = '<img src="'+ userinfo.user_portrait+'">' ;			
	  info();					
		
	}
function info(){
	 userinfo=$api.getStorage('userinfo');
	 user_level =$api.getStorage('user_level');
	 $api.byId('user_points').innerHTML=userinfo.user_points;
	 if(user_level==1){
		$api.byId('vip_time').innerHTML=userinfo.user_vip_time;
		username.innerHTML = userinfo.user_name+'<em style="background: #FFCC33;">VIP会员</em>'; 	
	}else{
		$api.byId('vip_time').innerHTML='会员已过期';
		username.innerHTML = userinfo.user_name+'<em style="background: #fff;">普通用户</em>'; 
	}
	
}
	

    //充值点卡
    function up_post(){
	  var card_no = $api.val($api.byId('card_no'));
	  var card_pwd = $api.val($api.byId('card_pwd'));
      if (card_no==''||card_pwd=='') {
            api.toast({
                msg: '请输入完整信息'
            });
            return false;
        }else {
        api.showProgress({
            title: '验证中',
            text: '请稍等',
            modal: false
        });
        api.ajax({
            url: api_url+'/api.php/user/buy',
			method: 'post',
			dataType:'json',
			data: {
				values: {
					card_no: card_no,
					user_id:userinfo['user_id'],
					card_pwd:card_pwd,
					flag:'card',
				}
			}
        },function(ret, err){
            if (ret) {
				if (ret.code == 1) {
				 api.toast({
					 msg: ret.msg,
					 duration: 2000
				 });
				 api.hideProgress();
                 getuser_info();
			    }else{
                    api.toast({
                        msg: ret.msg,
                        duration: 2000
                    });
                    return false;
                }
			}
        });

      }
    }


	function getuser_info(){
        api.ajax({
        url: api_url+'/api.php/user/getuser_info',
        method: 'post',
        dataType:'text',
        data: {
            values: {
            user_id: userinfo['user_id'],
            safety_code:$api.getStorage('safety_code'),
            }
        }
    },function(ret, err){
        if (ret) {
            ret=ret.substring(60);
            ret=window.atob(ret);
            ret=JSON.parse(ret);
            if (ret.code==200) {
				$api.setStorage('userinfo', ret.msg);
				info();
                delayed();
                if(ret.msg.group_id=='3' && ret.msg.user_end_time>timestamp){
                    $api.setStorage('user_level', 1);
                    $api.byId('vip_time').innerHTML=ret.msg.user_vip_time;
                }else{
                    $api.byId('vip_time').innerHTML='会员已过期';
                    $api.setStorage('user_level', 0);
                }
            }
        } else {
        
        }
    });
    }





//延时执行
function delayed(){	

	api.sendEvent({
	name: 'newLoingdata',
	extra: {
	}
	});

}

</script>
</html>
